//Jeff Szcinski & KQBright
//Lab 1
//ECEN 4243
//Spring 2014

module alu32 (d, Cout, V, a, b, Cin, S); //final version 
	output [31:0] d; 
	output Cout, V; 
	input [31:0] a, b; 
	input Cin; 
	input [2:0] S; 
	 
	wire [31:0] c, g, p; 
	wire gout, pout; 
	
	Alu_cell cell1[31:0] ( 
		.d(d), 
		.g(g), 
		.p(p), 
		.a(a), 
		.b(b), 
		.c(c), 
		.S(S) 
	); 
	
	Lac5 lac ( 
		.c(c), 
		.gout(gout), 
		.pout(pout), 
		.Cin(Cin), 
		.g(g), 
		.p(p) 
	); 
	
	assign Cout = gout | (pout & Cin); 
	assign V = Cout ^ c[31]; 
endmodule